package com.zhongyu.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhongyu.mapper.ChuKuMapper;
import com.zhongyu.pojo.Order;
import com.zhongyu.service.ChuKuService;
import com.zhongyu.vo.PageResult;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("outService")
public class ChuKuServiceImpl extends ServiceImpl<ChuKuMapper, Order> implements ChuKuService {
    @Resource
    private ChuKuMapper chuKuMapper;

    @Override
    public PageResult searchAll(Integer pageNo, Integer pageSize) {
//        LambdaQueryWrapper<Order> wrapper= Wrappers.<Order>lambdaQuery();
        Page page=new Page(pageNo,pageSize);
        List<Order> list=chuKuMapper.findAll(page);
        return new PageResult(list,page.getTotal());
    }

    @Override
    public List<Order> searchAll(Integer id) {
        return chuKuMapper.searchAll(id);
    }

    @Override
    public List<Order> search(Integer id) {
        return chuKuMapper.search(id);
    }
    @Override
    public void update(Order role) {

        chuKuMapper.updateById(role);

    }
}
